package com.example.online_order.mapper;

import com.example.online_order.pojo.Evalate;
import com.example.online_order.pojo.Goods;
import org.apache.ibatis.annotations.*;

import java.util.List;


public interface GoodsMapper {
    //    查询（菜名名称模糊查询） 增删改
    @Select("select * from goods")
    public List<Goods> getAllGoods();

    @Select("select * from goods where id =#{id}")
    public  Goods getById(Integer id);

    @Select("select * from goods where  mealName like '%${mealName}%'")
    public List<Goods> selectGood(String mealName);

    @Insert("insert into goods values (null, #{mealName}, #{mealType}, #{price}, #{mealPicture}, #{mealNum}, #{description})")
    public Integer addGoods(Goods goods);

    @Delete("delete from goods where id =#{id}")
    public Integer deleteGoods(Integer id);

    @Update("update goods set" +
            " mealName= #{mealName}," +
            "mealType = #{mealType}," +
            " price= #{price}, " +
            "mealPicture= #{mealPicture}, " +
            "mealNum= #{mealNum}, " +
            "description= #{description} where id= #{id}")
    public Integer updateGoods(Goods goods);


    public List<Goods> selectDsql(String mealName,String mealType );

    @Select("SELECT DISTINCT mealType FROM goods")
    public List<Goods> getmealType();

}
